package dev.blogmoon.cn.admin.controller;

import cn.dev33.satoken.stp.StpUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import dev.blogmoon.cn.admin.entity.AdminUserInfo;
import dev.blogmoon.cn.admin.service.AdminUserInfoService;
import dev.blogmoon.cn.common.entity.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/api/v1/admin/user")
@RestController
public class AdminUserController {

    @Autowired
    private AdminUserInfoService adminUserInfoService;

    @GetMapping("/info")
    public Result getUserInfo() {
        AdminUserInfo adminUserInfo = adminUserInfoService.getOne(
                Wrappers.<AdminUserInfo>lambdaQuery().eq(AdminUserInfo::getBizAcctId, StpUtil.getLoginIdAsLong()));
        return Result.success(adminUserInfo);
    }



}
